package com.woniuxy.java106crm.service.impl;

import com.woniuxy.java106crm.mapper.UserMapper;
import com.woniuxy.java106crm.service.CustomUserDetailService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CustomUserDetailServiceImpl implements CustomUserDetailService {
    @Resource
    private UserMapper userMapper;
    //通过账号查询用户信息
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
       //查询用户信息、权限、角色
        return userMapper.findByAccount(username);
    }
}
